#ifndef OPENINGUPDATEAPPRESPONSE_H
#define OPENINGUPDATEAPPRESPONSE_H

#include "network/networkjsonlistresponse.h"

#include <QObject>
#include <QMap>
#include <QList>
#include "newspaper/sourcedetail.h"

class CategoryPaper;
class SourceCategoryInfo;

class OpeningUpdateAppResponse : public Network::JSONResponse
{
    Q_OBJECT
public:
    explicit OpeningUpdateAppResponse(QObject *parent = 0);

    Network::Response::Type type() const;

    inline QString simageDomain() const {
        return m_simageDomain;
    }

    inline QList < int > listSourceCateInfoIdDefault() const {
        return m_listSourceCateInfoIdDefault;
    }

    inline QList < int > listCategoryIDInfoDefault() const {
        return m_listCategoryIDInfoDefault;
    }

    inline QList < CategoryInfo* > listCategoryPaper() const {
        return m_listCategoryPaper;
    }

    inline QList < SourceCategoryInfo* > listSourceCategoryInfo() const {
        return m_listSourceCategoryInfo;
    }

    inline bool checkReplyDataSuccess() const {
        return m_checkReplyDataSuccess;
    }

    inline QList< SourceDetail*> getListSourceDetail() const {
        return m_listSourceDetail;
    }

    inline QMap< int, SourceDetail*> getMapId2SourceDetail() const {
        return m_mapId2SourceDetail;
    }

private:

    void parse(const QVariant &data);
    bool parseSidsLastUpdate(const QVariantMap &map);
    bool parseDefaultSourcesId(const QVariantMap &map);
    bool parseDefaultCatesId(const QVariantMap &map);
    bool parseSimageDomain(const QVariantMap &map);
    bool parseListCategoryPaper(const QVariantMap &map);

    bool parseListSourcesInfo(const QVariantMap &map);


    QString m_simageDomain;
    QList < int > m_listSourceCateInfoIdDefault;
    QList < int > m_listCategoryIDInfoDefault;

private:

    QList < CategoryInfo* > m_listCategoryPaper;
    QList < SourceCategoryInfo* > m_listSourceCategoryInfo;

    bool m_checkReplyDataSuccess;

private:
    // tungvc chinh lai source
    SourceDetail* parseASourceDetail(const QVariantMap& map);

    QMap< int, SourceDetail*> m_mapId2SourceDetail;
    QList< SourceDetail*> m_listSourceDetail;


};

#endif // OPENINGUPDATEAPPRESPONSE_H
